package com.jh.complicate.serializable;

import com.alibaba.fastjson.JSON;

/**
 * @author Administrator
 * @projectName newforward
 * @title FastJsonSerializer.java
 * @package com.jh.complicate.serializable
 * @description FastJson序列化
 * @date 2019/6/5 10:14
 */
public class FastJsonSerializer implements ISerializable{

    @Override
    public <T> byte[] serialize(T obj) {
        return JSON.toJSONString(obj).getBytes();
    }

    @Override
    public <T> T deserialize(byte[] data, Class clazz) {
        return (T) JSON.parseObject(new String(data), clazz);
    }

}
